const service = require('../services/sync');
const {logger} = require('../services/logger');
// get block info 
let getTransanctions = async (ctx, next) => {
    try {

        // TODO get info from DB
        let txid = ctx.query.txid
        if (txid == undefined) {
            ctx.body = { status: "0000", errCode: "10001", msg: 'txid is be requeired' }
            return;
        }
        let result = await service.getTransanctions(txid);

        ctx.body = { status: "0000" }
        ctx.body.data = result;
    } catch (error) {
        logger.error("getTransanctions error===>", error);
    }
    next();
}

module.exports = { getTransanctions }